package com.efesco.payroll.query;

import com.bstek.dorado.view.AbstractViewModel;
import com.bstek.dorado.common.DoradoContext;
import com.bstek.dorado.data.*;
import com.bstek.dorado.view.data.*;
import com.bstek.dorado.view.control.*;
import com.efesco.payroll.PayrollTools;
import com.efesco.common.Tools;

/**
 * sendDetailViewModel
 */
public class sendDetailViewModel extends AbstractViewModel {
  private String columnsByDisplay="";
  protected void loadData(String id, ViewDataset dataset)
      throws Exception {
    super.loadData(id, dataset);
    if("datasetShowColumns".equals(id)){
            dataset.moveFirst();
            columnsByDisplay=dataset.getValue(0).toString();

    }
    if ("datasetDataEditView".equals(id)) {

            DoradoContext context=DoradoContext.getContext();
            String wageSendID=(String)context.getParameter("wa_send_id");
            String groupIds=(String)context.getParameter("WA_GROUP_ID");

            PayrollTools.filterColumns(dataset,wageSendID,columnsByDisplay,groupIds,context);
            PayrollTools.changeColumnName(dataset,context,1,wageSendID);
            Tools.toSumDataset(dataset,"employee_name");


    }
  }

}
